//package com.github.vole.auth.config;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.cache.annotation.EnableCaching;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnection;
//import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
//import org.springframework.data.redis.connection.jedis.JedisClientConfiguration;
//import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
//import redis.clients.jedis.JedisPoolConfig;
//
//@Configuration
//@EnableCaching
//public class RedisConfig {
//
//    @Autowired
//    JedisConfig jedisConfig;
//
//    @Bean
//    public JedisConnectionFactory jedisConnectionFactory () {
//        RedisStandaloneConfiguration rf = new RedisStandaloneConfiguration();
//        rf.setDatabase(jedisConfig.database);
//        rf.setHostName(jedisConfig.host);
//        rf.setPort(jedisConfig.port);
//        int to = Integer.parseInt(jedisConfig.timeout.substring(0, jedisConfig.timeout.length() - 2));
//        JedisClientConfiguration.JedisPoolingClientConfigurationBuilder jpb =
//                (JedisClientConfiguration.JedisPoolingClientConfigurationBuilder) JedisClientConfiguration.builder();
//        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
//        jedisPoolConfig.setMaxIdle(jedisConfig.maxIdle);
//        jedisPoolConfig.setMinIdle(jedisConfig.minIdle);
//        jedisPoolConfig.setMaxTotal(jedisConfig.maxActive);
//        int l = Integer.parseInt(jedisConfig.maxWait.substring(0, jedisConfig.maxWait.length() - 2));
//        jedisPoolConfig.setMaxWaitMillis(l);
//        jpb.poolConfig(jedisPoolConfig);
//        JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(rf, jpb.build());
//        return jedisConnectionFactory;
//    }
//}
